package OperateurSystem;

/**
 * Interface definition : GestionColis
 * 
 * @author OpenORB Compiler
 */
public class _GestionColisStub extends org.omg.CORBA.portable.ObjectImpl
        implements GestionColis
{
    static final String[] _ids_list =
    {
        "IDL:OperateurSystem/GestionColis:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = OperateurSystem.GestionColisOperations.class;

    /**
     * Operation demanderSuiviColis
     */
    public String demanderSuiviColis(int idColis)
        throws OperateurSystem.GestionColisPackage.ColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("demanderSuiviColis",true);
                    _output.write_long(idColis);
                    _input = this._invoke(_output);
                    String _arg_ret = _input.read_string();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("demanderSuiviColis",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    return _self.demanderSuiviColis( idColis);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation accordLivraison
     */
    public int accordLivraison(int idFrs, int idColis)
        throws OperateurSystem.GestionColisPackage.ColisDejaTransporteException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("accordLivraison",true);
                    _output.write_long(idFrs);
                    _output.write_long(idColis);
                    _input = this._invoke(_output);
                    int _arg_ret = _input.read_long();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.ColisDejaTransporteExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.ColisDejaTransporteExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("accordLivraison",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    return _self.accordLivraison( idFrs,  idColis);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation retirerColis
     */
    public void retirerColis(int codeRetraitUnique)
        throws OperateurSystem.GestionColisPackage.ColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("retirerColis",true);
                    _output.write_long(codeRetraitUnique);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("retirerColis",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    _self.retirerColis( codeRetraitUnique);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation deposerColisA
     */
    public int deposerColisA(int adherentExp, int adherentDest)
        throws OperateurSystem.GestionColisPackage.ColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("deposerColisA",true);
                    _output.write_long(adherentExp);
                    _output.write_long(adherentDest);
                    _input = this._invoke(_output);
                    int _arg_ret = _input.read_long();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("deposerColisA",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    return _self.deposerColisA( adherentExp,  adherentDest);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation deposerColisF
     */
    public void deposerColisF(int idFrs, int idColis, int idStation)
        throws OperateurSystem.GestionColisPackage.MauvaiseStationException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("deposerColisF",true);
                    _output.write_long(idFrs);
                    _output.write_long(idColis);
                    _output.write_long(idStation);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.MauvaiseStationExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.MauvaiseStationExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("deposerColisF",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    _self.deposerColisF( idFrs,  idColis,  idStation);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation calculerPrix
     */
    public int calculerPrix(int adherentExp, int adherentDest)
        throws OperateurSystem.GestionColisPackage.DestinataireInexistantException, OperateurSystem.GestionColisPackage.ColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("calculerPrix",true);
                    _output.write_long(adherentExp);
                    _output.write_long(adherentDest);
                    _input = this._invoke(_output);
                    int _arg_ret = _input.read_long();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.DestinataireInexistantExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.DestinataireInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.id()))
                    {
                        throw OperateurSystem.GestionColisPackage.ColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("calculerPrix",_opsClass);
                if (_so == null)
                   continue;
                OperateurSystem.GestionColisOperations _self = (OperateurSystem.GestionColisOperations) _so.servant;
                try
                {
                    return _self.calculerPrix( adherentExp,  adherentDest);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
